import React, { Component } from 'react';
import {
    StyleSheet,
    View,
    Image,
    Text
} from 'react-native'
import Constant from '../../../constant/Constants';
import ToolsUtil from '../../../util/ToolsUtil';
/**
 * 我的页面头部view
 */
export default class MineHeaderView extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        var data = this.props.headerInfo ? {
            iconTxt: this.props.headerInfo.iconTxt,
            title: this.props.headerInfo.title,
            subTitle: this.props.headerInfo.subTitle
        } : {
                //默认值
                iconTxt: '商',
                title: '暂无商家名称',
                subTitle: '暂无商家名称'
            };
        return (
            <View style={Style.container}>
                <View style={{ backgroundColor: 'green', borderRadius: 90 }}>
                    <Text style={Style.iconUser}>{data.iconTxt}</Text>
                </View>
                <View style={{ height: 45, marginLeft: 10 }}>
                    <Text style={Style.title}>{data.title}</Text>
                    <Text style={Style.subTitle}>{data.subTitle}</Text>
                </View>
            </View>
        );
    }

}

const Style = StyleSheet.create({
    container: {
        flex: 1,
        flexDirection: 'row',
        backgroundColor: Constant.COLOR.ColorBlue,
        height: 100,
        alignItems: 'center',
        padding: 15,
    },
    iconUser: {
        color: Constant.COLOR.ColorWhite,
        width: 45,
        height: 45,
        borderRadius: 10,
        textAlign: 'center',
        ...ToolsUtil.styleByOS({
            ios: {
                lineHeight: 45
            },
            android: {

            }
        })

    },
    title: {
        flex: 1,
        color: Constant.COLOR.ColorWhite,
        fontSize: 15,
    },
    subTitle: {
        flex: 1,
        color: Constant.COLOR.ColorWhite,
        fontSize: 14,
    }
});